package com.fd.fdsso.web.intercept;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.fd.fdsso.utils.SSoUtils;
import com.fd.util.MyUtils;

/**
 * 系统拦截器
 * 
 * @author 符冬
 * 
 */
public class SSoInterceptor extends HandlerInterceptorAdapter {
	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		/**
		 * 初始化域名
		 */
		if (!MyUtils.isNotEmpty(SSoUtils.SSO_DOMAIN)) {
			SSoUtils.SSO_DOMAIN = request.getLocalName().replaceAll("www.", "");
		}
		return super.preHandle(request, response, handler);
	}

}
